home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / COMP_RAY.DMO < prev    next >
Text File  |  1996-07-04  |  4KB  |  73 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-11-15 ╟─╖
  5.  │  │ FILE NAME   COMP_RAY.DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16.  RayPoint like it's big cousin PolygonPoint computes the X,Y position of a
  17.  ray given certain information about the circle being used. It assumes that
  18.  Point number 0 is at 12:00 (North) and that the points move clockwise
  19.  around the circle. This makes it especially handy for clocks, timers and
  20.  the like.
  21. $endif
  22.  
  23. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  24. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  25. $INCLUDE "PUBLICS.INC"                        ' uses pPi#
  26. $INCLUDE "DAS-NBV1.INC"                       '
  27.                                               '
  28. CLS                                           '
  29. SCREEN 12                                     ' works better than text mode :)
  30. GraphicSETUP                                  '
  31. COLOR 9                                       '
  32. LOCATE 29, 30                                 '
  33. PRINT "Press any key to quit.";               '
  34.                                               '
  35.                                               ' A SIMPLE CLOCK
  36. X% = 320 : Y% = 232                           '  center coordinates
  37. DO                                            '
  38.   FOR I% = 50 TO 70 STEP 2                    '  Clock border
  39.     CIRCLE (X%,Y%), I%, 9                     '
  40.   NEXT                                        '
  41.   CIRCLE (X%,Y%), I%-1, 9                     '
  42.   CIRCLE (X%,Y%), 2, 15                       '  center stem
  43.   PAINT  (X%,Y%), 15, 15                      '
  44.   LOCATE 14, 38 : PRINT "DASoft"              '  infomerical
  45.                                               '
  46.   FOR I% = 0 TO 11                            ' 12 number buttons
  47.     RayPoint X%, Y%, 50, 1, 12, I%, C%, R%    '   compute coordinates
  48.     CIRCLE (C%,R%), 2, 14                     '   draw circle
  49.     PAINT  (C%,R%), 14, 14                    '   fill it
  50.   NEXT                                        '
  51.   H% = VAL( TIME$ )                           ' Hours
  52.   M% = VAL( MID$( TIME$, 4 ) )                ' Minutes
  53.   RayPoint X%, Y%, 35, 1, 12, H%, C%, R%      '   compute hour hand
  54.   LINE ( X%, Y% ) - ( C%, R% ), 15            '   draw it
  55.   RayPoint X%, Y%, 45, 1, 60, M%, C%, R%      '   compute minute hand
  56.   LINE ( X%, Y% ) - ( C%, R% ), 15            '   draw it
  57.   DO                                          ' seconds
  58.     S% = VAL( MID$( TIME$, 7 ) )              '
  59.     RayPoint X%, Y%, 49, 1, 60, S%, C%, R%    '   compute
  60.     GLineDRAW X%, Y%, C%, R%, 0, 2, 12        '   XOR on the second hand
  61.     WHILE S% = VAL( MID$( TIME$, 7 ) )        '   wait a second
  62.     WEND                                      '
  63.     GLineDRAW X%, Y%, C%, R%, 0, 2, 12        '   XOR off the second hand
  64.     IF INSTAT THEN EXIT, EXIT                 ' press any key to exit
  65.   LOOP UNTIL S% = 0                           ' redraw to set minute hand
  66.   CLS                                         '
  67. LOOP                                          '
  68.  
  69. CLS
  70. SCREEN 0
  71.  
  72.  
  73.